<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
        测试websocket

</body>
<script>
    let socket = new WebSocket("ws://192.168.1.120:55551/websocket");
    socket.onopen = function () {
        console.log("websocket open");
        let obj={"authCode":"123","requestType":"login"}
        socket.send(JSON.stringify(obj))
    }
    socket.onmessage = function (message) {
        console.log(message);
    }
    socket.onclose = function (event) {
        console.log("websocket close");
    }
    socket.onerror = function (event) {
        socket.close();
        console.log("websocket error");
    }
</script>
</html>